package com.leesche.zcsp.node.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.leesche.zcsp.node.web.dao.PubDiscountDao;
import com.leesche.zcsp.node.web.model.PubDiscount;
import com.leesche.zcsp.node.web.model.PubDiscountCriteria;
import com.leesche.zcsp.node.web.service.PubDiscountService;
import com.leesche.zcsp.node.web.service.impl.data.read.PubDiscountDto;
import com.leesche.zcsp.node.web.service.impl.data.read.QueryPubDiscountCondition;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Title: PubDiscountServiceImpl.java
 * @Package com.leesche.zcsp.node.service.impl
 * @Description:()
 * @author dennies yang
 * @date 2016年9月22日 下午4:23:22
 * @version V1.0
 */
@Service
@Transactional
public class PubDiscountServiceImpl
		extends
		BaseServiceImpl<PubDiscount, PubDiscountCriteria, PubDiscountDto, QueryPubDiscountCondition, Long>
		implements PubDiscountService {
	@Autowired
	private PubDiscountDao pubDiscountDao;

	@Autowired
	public void setBaseDao(PubDiscountDao pubDiscountDao) {
		super.setBaseDao(pubDiscountDao);
	}
	public  List<PubDiscountDto> findPubDiscountByShortCode(QueryPubDiscountCondition condition){
		return pubDiscountDao.selectByShortCode(condition);
	}

	@Override
	public List<PubDiscountDto> findDiscountList(QueryPubDiscountCondition condition) {
		return pubDiscountDao.findPubDiscountList(condition);
	}


	/**
	 * @Title: addDefaultDiscount
	 * @Description: TODO( 新增设备默认套餐 )
	 * @author Jerry
	 * @date 2016-11-04 01:07:27
	 * @param discounts 默认套餐集合
	 * @return 添加结果
	 */
	@Override
	public int addDefaultDiscount(List<PubDiscount> discounts) {
		return pubDiscountDao.insertBatchDiscount(discounts);
	}
}
